<!doctype html>
<html class="x-admin-sm" lang="en"
      xmlns:th="https://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>
    <meta charset="UTF-8">
    <title th:text="${#util.properties('system.name')}"></title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="shortcut icon" th:href="@{/favicon.ico}"/>
    <link rel="stylesheet" href="//at.alicdn.com/t/font_2678238_81zt3lo6ktc.css">
    <link rel="stylesheet" th:href="@{/assets/icon/iconfont.css}">
    <link rel="stylesheet" th:href="@{/assets/admin/css/font.css}">
    <link rel="stylesheet" th:href="@{/assets/admin/css/xadmin.css}">
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script th:src="@{/assets/admin/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/assets/admin/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        // 是否开启刷新记忆tab功能
        // var is_remember = false;
    </script>
    <style type="text/css">
        .layui-nav, .layui-nav .layui-nav-item a {
            padding: 0 10px;
        }

        .layui-nav-more {
            top: 23px;
        }
    </style>
</head>
<body class="index">
<!-- 顶部开始 -->
<div class="container">
    <div class="logo layui-hide-xs">
        <a href="javascript:viod(0);" th:text="${#util.properties('system.name')}"></a>
    </div>
    <div class="left_open">
        <a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
    </div>
    <ul class="layui-nav left" lay-filter="">
        <li class="layui-nav-item">
            <a href="javascript:void(0);" id="fullBtn" onclick="clickFullScreen(this)"> <i
                    class="layui-icon layui-icon-screen-full" style="font-size: 15px"></i></a>
        </li>
        <shiro:hasAnyRoles name="admin,管理员">
            <li class="layui-nav-item">
                <a href="javascript:;" style="padding: 0 20px;">+新增</a>
                <dl class="layui-nav-child">
                    <!-- 二级菜单 -->
                    <dd>
                        <a onclick="xadmin.open('最大化','http://www.baidu.com','','',true)">
                            <i class="iconfont">&#xe6a2;</i>弹出最大化</a></dd>
                    <dd>
                        <a onclick="xadmin.open('弹出自动宽高','http://www.baidu.com')">
                            <i class="iconfont">&#xe6a8;</i>弹出自动宽高</a></dd>
                    <dd>
                        <a onclick="xadmin.open('弹出指定宽高','http://www.baidu.com',500,300)">
                            <i class="iconfont">&#xe6a8;</i>弹出指定宽高</a></dd>
                    <dd>
                        <a onclick="xadmin.add_tab('在tab打开','member-list.html')">
                            <i class="iconfont">&#xe6b8;</i>在tab打开</a></dd>
                    <dd>
                        <a onclick="xadmin.add_tab('在tab打开刷新','member-del.html',true)">
                            <i class="iconfont">&#xe6b8;</i>在tab打开刷新</a></dd>
                </dl>
            </li>
        </shiro:hasAnyRoles>
    </ul>
    <ul class="layui-nav right" lay-bar="disabled">
        <li class="layui-nav-item">
            <a href="javascript:;" style="width: 35px" id="notic"> <i class="layui-icon layui-icon-notice"
                                                                      style="font-size: 15px"></i><span
                    class="layui-badge">9</span></a>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:;" id="theme"> <i class="layui-icon layui-icon-theme" style="font-size: 15px"></i></a>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:void(0);" th:inline="text" style="padding-right: 20px;height: 47px;">
                <img th:src="${user == null?'':user.profileUrl}" class="layui-nav-img"/>[[${user ==
                null?'我':user.name}]]</a>
            <dl class="layui-nav-child">
                <dd><a href="javascript:;" onclick="xadmin.open('个人信息','/system/userInfo',600)">个人信息</a></dd>
                <dd><a href="javascript:;" onclick="xadmin.open('修改密码','http://www.baidu.com')">修改密码</a></dd>
                <dd><a href="javascript:;" onclick="logout()">退出</a></dd>
            </dl>
        </li>
    </ul>
</div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<!-- 左侧菜单开始 -->
<div class="left-nav" style="padding-top: 0px;">
    <div id="side-nav">
        <ul id="nav">
            <li th:each="menu:${menus}">
                <a href="javascript:;">
                    <i class="iconfont left-nav-li" th:lay-tips="${menu.parentMenu.menuname}"
                       th:utext="${menu.parentMenu.iconCode}">&#xe6b8;</i>
                    <cite th:text="${menu.parentMenu.menuname}">默认菜单</cite>
                    <i class="iconfont nav_right">&#xe697;</i>
                </a>
                <ul class="sub-menu">
                    <li th:each="cmenu:${menu.submenu}">
                        <a th:data-menunama="${cmenu.menuname}"
                           th:data-url="${cmenu.url}"
                           onclick="xadmin.add_tab(this.getAttribute('data-menunama'),this.getAttribute('data-url'))">
                            <i th:if="${#strings.isEmpty(cmenu.iconCode)? false :#strings.contains(cmenu.iconCode,'&#')}"
                               class="iconfont" th:utext="${cmenu.iconCode}">&#xe705;</i>
                            <i th:if="${#strings.isEmpty(cmenu.iconCode)? false :#strings.contains(cmenu.iconCode,'iconfont')}"
                               th:class="${cmenu.iconCode}" style="font-size: 18px;"> </i>
                            <cite th:text="${cmenu.menuname}">默认子集菜单</cite></a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</div>
<!-- <div class="x-slide_left"></div> -->
<!-- 左侧菜单结束 -->
<!-- 右侧主体开始 -->
<div class="page-content" style="margin-top: 2px;">
    <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
        <ul class="layui-tab-title">
            <li class="home">
                <i class="layui-icon">&#xe68e;</i>我的桌面
            </li>
        </ul>
        <div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">
            <dl>
                <dd data-type="this">关闭当前</dd>
                <dd data-type="other">关闭其它</dd>
                <dd data-type="all">关闭全部</dd>
            </dl>
        </div>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <iframe src='./welcome' frameborder="0" scrolling="yes" class="x-iframe"></iframe>
            </div>
        </div>
        <div id="tab_show"></div>
    </div>
</div>
<div class="page-content-bg"></div>
<style id="theme_style"></style>
<!-- 右侧主体结束 -->
<!-- 中部结束 -->
<script th:src="@{/assets/admin/js/jquery.min.js}"></script>
<script th:replace="systemCommon/HarinCommon :: commonJs"></script>
<script type="text/javascript">//百度统计可去掉
let exitFullscreenFlag = false;
let notice;
$(document).ready(function () {
    $(window).resize(function () {
        var isFull = !!(document.webkitIsFullScreen || document.mozFullScreen ||
            document.msFullscreenElement || document.fullscreenElement
        ); //!document.webkitIsFullScreen都为true。因此用!!
        if (isFull == false) {
            document.exitFullscreenFlag = false;
            let screenBtn = $(".layui-icon-screen-restore");
            screenBtn.removeClass("layui-icon-screen-restore");
            $("#fullBtn").parent().removeClass("layui-this");
            screenBtn.addClass("layui-icon-screen-full");
        } else {
            document.exitFullscreenFlag = true;
            let screenBtn = $(".layui-icon-screen-full");
            $("#fullBtn").parent().addClass("layui-this");
            screenBtn.removeClass("layui-icon-screen-full");
            screenBtn.addClass("layui-icon-screen-restore");
        }
    });

    let find = $(".logo").find("a");
    if (find.length > 1) {
        $(".logo a:last").remove();
    }
    $("#addA").on('click', function () {
        //console.log(notice);
        notice.addNews({
            "lowKey": true,
            "classTypeId": "other",
            "content": [{
                "title": "【其它】一条来自测试的消息消息消息消息消息消息消息消息消息",
                "content": "一条来自测试的消息，最多20字，最多20字，最多20字，最多20字，最多20字，最多20字",
                "date": "2021-08-10 19:30:36",
                "url": "https://www.baidu.com"
            }]
        });
        notice.openHide();
    })
    changeTheme();
});


layui.config({
    base: '/assets/admin/lib/layui/mods/'
}).extend({
    jsanNotice: "jsan-notice"
});

layui.use(['jsanNotice'], function (mods) {
    let croppers = layui.croppers;
    notice = layer.noticeMarker({
        "elem": "#noticeMarker",
        "positionX": "right",
        "positionY": "100px",
        "index": 999999,
        "lowKey": true,
        "clickEl": "#notic",
        "allRead": function () {
            $("#notic").parse().addClass("layui-this");
            console.log("全读成功！！");
        },
        "noticeWindow": {
            "type": 1,
            "title": "消息",
            "classType": {"notice": "通知", "other": "其他"},
            "width": "300px",
            "height": "520px",
            "contentWidth": "80%",
            "contentHeight": "65%"
        }
    });

    //手动推送新消息，在使用消息组件自带的消息窗口时使用
    notice.addNews({
        "lowKey": true,
        "classTypeId": "notice",
        "content": [{
            "title": "【通知】一条来自测试的消息消息消息消息消息消息消息消息消息",
            "content": "一条来自测试的消息，最多20字，最多20字，最多20字，最多20字，最多20字，最多20字",
            "date": "2019-07-28 19:30:36",
            "url": "https://www.baidu.com"
        },
            {
                "title": "【通知】一条来自测试的消息消息消息消息消息消息消息消息消息",
                "content": "一条来自测试的消息，最多20字，最多20字，最多20字，最多20字，最多20字，最多20字",
                "date": "2019-07-28 19:30:36",
                "url": "https://www.baidu.com"
            },
            {
                "title": "【通知】一条来自测试的消息消息消息消息消息消息消息消息消息",
                "content": "一条来自测试的消息，最多20字，最多20字，最多20字，最多20字，最多20字，最多20字",
                "date": "2019-07-28 19:30:36",
                "url": "https://www.baidu.com"
            },
            {
                "title": "【通知】一条来自测试的消息消息消息消息消息消息消息消息消息",
                "content": "一条来自测试的消息，最多20字，最多20字，最多20字，最多20字，最多20字，最多20字",
                "date": "2019-07-28 19:30:36",
                "url": "https://www.baidu.com"
            },
            {
                "title": "【通知】一条来自测试的消息消息消息消息消息消息消息消息消息",
                "content": "一条来自测试的消息，最多20字，最多20字，最多20字，最多20字，最多20字，最多20字",
                "date": "2019-07-28 19:30:36",
                "url": "https://www.baidu.com"
            }
        ]
    });
});


//监听window是否全屏，并进行相应的操作,支持esc键退出
function clickFullScreen(t) {
    if (!document.exitFullscreenFlag) {
        console.log($(t).parent());
        $(t).parent().addClass("layui-this");
        handleFullScreen();
    } else {
        $(t).parent().removeClass("layui-this");
        exitFullscreen();
        //console.log($(t).parent(".layui-nav-item"));
    }
}

//进入全屏
function handleFullScreen() {
    var element = document.documentElement;
    if (this.fullscreen) {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
    } else {
        if (element.requestFullscreen) {
            element.requestFullscreen();
        } else if (element.webkitRequestFullScreen) {
            element.webkitRequestFullScreen();
        } else if (element.mozRequestFullScreen) {
            element.mozRequestFullScreen();
        } else if (element.msRequestFullscreen) {
            // IE11
            element.msRequestFullscreen();
        }
    }
}

function exitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }
}

function logout() {
    $.ajax({
        url:  "/user/logout",
        type: "get",
        success: function (data) {
            window.location.href = "/login"
        }
    })
}

//读取本地主题信息
function changeTheme() {
    //localStorage.setItem("harinTheme",{"color":"#ff8a8a"});
    let theme = JSON.parse(localStorage.getItem("harinTheme"));
    if (theme != null && !isEmpty(theme.color)) {
        $(".container").css("background-color", theme.color);
    }


}
</script>
<div id="noticeMarker"></div>
</body>

</html>